<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="body">
            <p:panel style="height: 2px;" rendered="#{!managerLayout.desabilitarMapa() and managerEditarImovel.connect}" >
                <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" />
            </p:panel>

            <h3 class="title">Atualizar Boletim de Cadastro Imobiliário</h3>

            <style>
                .ui-tabs .ui-tabs-nav.ui-widget-header li.ui-state-active a, .ui-tabs .ui-tabs-nav.ui-widget-header li.ui-state-active a {
                    background-color: #69B8EA !important;
                    background-image: -moz-linear-gradient(center top , #69B8EA, #69B8EA) !important;
                    color: #FFFFFF !important;
                    width: 89%;
                }
            </style>

            <h:form id="realtyForm" enctype="multipart/form-data">
                <p:growl id="messages" showDetail="false" autoUpdate="true"  />

                <hr/>

                <p:tabView id="tabView" orientation="left" onTabChange="processPanelGaleria(); processPanelGaleriaCroqui();">

                    <p:tab id="tabf" title="Dados Gerais">

                        <p:panel id="situacao" styleClass="container_24" style="height: 35px; margin-bottom: 5px; margin-top: -30px;">
                            <div class="grid_15" style="float: right;">
                                <p:outputLabel value="Situação do Imóvel" for="situacaoImovel" styleClass="grid_10"/>

                                <div class="grid_14">
                                    <p:selectOneMenu id="situacaoImovel" panelStyle="width:150px;"
                                                     value="#{managerEditarImovel.imovel.situacaoImovel}">
                                        <f:selectItem itemLabel="" itemValue="" />
                                        <f:selectItems value="#{managerUtilitario.situacaoImovel}"/>
                                    </p:selectOneMenu>
                                </div>
                            </div>
                            <div class="clear"/>
                        </p:panel>

                        <h4 class="title">Dados Gerais</h4>

                        <fieldset>
                            <legend>Inscrição Cadastral</legend>

                            <p:panel id="realtyPanel" styleClass="container_24 clearfix ">

                                <p:outputLabel value="Inscrição Imóvel" styleClass="grid_5 inscricaoLabelImovel" for="maskinscricao" />
                                <p:inputMask mask="?99.99.999.9999.99" id="maskinscricao" 
                                             styleClass="grid_6"  value="#{managerEditarImovel.visaoInscricao}"/>
                                <p:watermark value="DD.SS.QUADR.LOTE.UN" for="maskinscricao" />

                            </p:panel>
                        </fieldset>

                        <fieldset>
                            <legend>Contribuinte</legend>
                            <p:panel id="proprietarioPanel" styleClass="container_24 clearfix withoutBorder">

                                <div style="float: left;width: 100%;margin-bottom: 10px">
                                    <p:outputLabel value="Proprietário" styleClass="grid_3 labelProprietario" for="proprietario"/>
                                    <p:autoComplete id="proprietario" styleClass="grid_20 autocompleteProprietario" dropdown="true" converter="proprietarioconverter"
                                                    var="proprietario"
                                                    itemLabel="#{proprietario.nome != null ? proprietario.nome.concat(' - ').concat(managerUtilitario.mascaraCpfCnpj(proprietario)) :
                                                                 proprietario.nomeFantasia.concat(' - ').concat(managerUtilitario.mascaraCpfCnpj(proprietario))}"
                                                    style="margin-top: -2px"
                                                    itemValue="#{proprietario}" value="#{managerEditarImovel.proprietario}"
                                                    scrollHeight="200" forceSelection="true" immediate="true"
                                                    completeMethod="#{managerUtilitario.autocompletePessoa}"/>
                                    <p:commandButton oncomplete="dlgProp.show()" icon="ui-icon-plus" style="margin-top: -1px"
                                                     update=":proprietarioForm" actionListener="#{managerProprietario.init()}"/>
                                    <div class="buttonAction">
                                        <p:commandButton value="Adicionar"
                                                         process="proprietarioPanel"
                                                         actionListener="#{managerEditarImovel.addProprietario()}"
                                                         update="proprietarioPanel, tableProprietario"
                                                         id="addOnwerCommandButton" icon="ui-icon-plus"/>
                                    </div>
                                    <div class="clear"/> 
                                </div>

                                <p:dataTable id="tableProprietario" var="item" value="#{managerEditarImovel.imovel.proprietarios}" 
                                             styleClass="grid_24" emptyMessage="Nenhum registro">  
                                    <f:facet name="header">
                                        Nome do Proprietário ou Detentor
                                    </f:facet>

                                    <p:column headerText="Ação" width="50" style="text-align: center">
                                        <p:commandButton oncomplete="dlgProp.show()" icon="ui-icon-search"
                                                         update=":proprietarioForm">
                                            <f:setPropertyActionListener target="#{managerProprietario.proprietario}" value="#{item}" />
                                            <f:setPropertyActionListener target="#{managerProprietario.readonly}" value="#{true}" />
                                        </p:commandButton>
                                        <p:commandButton  styleClass="optionButton" alt="Remover"
                                                          update=":realtyForm:tabView:proprietarioPanel, tableProprietario"
                                                          process="@this" icon="ui-icon-trash"
                                                          actionListener="#{managerEditarImovel.removerProprietario(item)}" />
                                    </p:column>

                                    <p:column headerText="Nome">  
                                        #{item.tipoDocumento eq null or item.tipoDocumento eq 'CPF' ? item.nome : item.nomeFantasia}
                                    </p:column>

                                    <p:column headerText="Documento" width="60">
                                        #{managerUtilitario.mascaraCpfCnpj(item)}
                                    </p:column> 

                                </p:dataTable>

                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend>Localização do Imóvel</legend>

                            <p:panel id="localPanel" styleClass="container_24 clearfix ">

                                <p:outputLabel value="CEP" styleClass="grid_3" for="cepInputMask" />
                                <p:inputMask id="cepInputMask" styleClass="grid_4" mask="99.999-999" autocomplete="false"
                                             value="#{managerEditarImovel.imovel.enderecoImovel.cep}" >
                                    <p:ajax event="blur" update=":realtyForm:tabView:localPanel"  
                                            listener="#{managerEditarImovel.existeEnderecoImovel()}" />
                                </p:inputMask>

                                <p:outputLabel value="Usar este endereço para correspondência" for="enderecoSelectBooleanCheckbox" />
                                <p:selectBooleanCheckbox id="enderecoSelectBooleanCheckbox" styleClass="grid_1"
                                                         value="#{managerEditarImovel.usarMesmoEndereco}" >
                                    <p:ajax event="change" update=":realtyForm:tabView:endCorrespondenciaPanel"
                                            listener="#{managerEditarImovel.usarEnderecoParaCorrespondencia()}" />
                                </p:selectBooleanCheckbox>

                                <div class="clear-both" />

                                <p:outputLabel value="Logradouro" styleClass="grid_3 logradouroLabelImovel" 
                                               style="width: 90px; margin-left: 4px" for="patioInputText" />
                                <p:inputText id="patioInputText" styleClass="grid_19" 
                                             value="#{managerEditarImovel.imovel.enderecoImovel.logradouro}" />

                                <div class="clear"/>
                                <p:outputLabel value="Bairro" styleClass="grid_3" for="neighborhoodInputText" />
                                <p:autoComplete id="neighborhoodInputText" styleClass="grid_20"  dropdown="true" converter="bairroconverter"   
                                                var="bairro" itemLabel="#{bairro.nome}" 
                                                itemValue="#{bairro}" value="#{managerEditarImovel.imovel.enderecoImovel.bairroDne}"
                                                scrollHeight="200" forceSelection="true"
                                                completeMethod="#{managerUtilitario.autocompleteBairroPorCidade}" /> 

                                <p:outputLabel value="Número" styleClass="grid_3" for="numInputText" />
                                <p:inputText id="numInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.enderecoImovel.numero}" />

                                <p:outputLabel value="Complemento" styleClass="grid_5 alpha" for="compInputText" />
                                <p:inputText id="compInputText" styleClass="grid_10"
                                             value="#{managerEditarImovel.imovel.enderecoImovel.compl}" />
                            </p:panel>
                        </fieldset>
                        <fieldset>
                            <legend>Endereço Correspondência</legend>

                            <p:panel id="endCorrespondenciaPanel" styleClass="container_24 clearfix ">

                                <p:outputLabel value="CEP" styleClass="grid_3" for="endcepInputMask" />
                                <p:inputMask id="endcepInputMask" styleClass="grid_4" mask="99.999-999" autocomplete="false"
                                             readonly="#{managerEditarImovel.usarMesmoEndereco}"
                                             value="#{managerEditarImovel.imovel.enderecoCorrespondencia.cep}">
                                    <p:ajax event="blur" update=":realtyForm:tabView:endCorrespondenciaPanel"  
                                            listener="#{managerEditarImovel.existeEnderecoCorrespondencia()}" />
                                </p:inputMask>
                                <div class="clear-both" />

                                <p:outputLabel value="Logradouro" styleClass="grid_3 logradouroLabelImovel" 
                                               style="width: 90px; margin-left: 4px" for="endpatioInputText" />
                                <p:inputText id="endpatioInputText" styleClass="grid_19"
                                             readonly="#{managerEditarImovel.desabilitarEnderecoCorrespondencia}"
                                             value="#{managerEditarImovel.imovel.enderecoCorrespondencia.logradouro}" />

                                <div class="clear"/>
                                <p:outputLabel value="Bairro" styleClass="grid_3" for="endneighborhoodInputText" />
                                <p:autoComplete id="endneighborhoodInputText" styleClass="grid_20"  dropdown="true" converter="bairroconverter"   
                                                var="bairro" itemLabel="#{bairro.nome}" 
                                                rendered="#{!managerEditarImovel.usarMesmoEndereco}"
                                                itemValue="#{bairro}" value="#{managerEditarImovel.imovel.enderecoCorrespondencia.bairroDne}"
                                                scrollHeight="200" forceSelection="true"
                                                completeMethod="#{managerUtilitario.autocompleteBairroPorCidade}" />
                                <p:inputText id="bairroInpuText" styleClass="grid_19"
                                             rendered="#{managerEditarImovel.usarMesmoEndereco}"
                                             readonly="#{managerEditarImovel.usarMesmoEndereco}"
                                             value="#{managerEditarImovel.imovel.enderecoCorrespondencia.bairroDne.nome}"/>

                                <p:outputLabel value="Número" styleClass="grid_3" for="endnumInputText" />
                                <p:inputText id="endnumInputText" styleClass="grid_4"
                                             readonly="#{managerEditarImovel.desabilitarEnderecoCorrespondencia and managerEditarImovel.usarMesmoEndereco}"
                                             value="#{managerEditarImovel.imovel.enderecoCorrespondencia.numero}" />

                                <p:outputLabel value="Complemento" styleClass="grid_5 alpha" for="endcompInputText" />
                                <p:inputText id="endcompInputText" styleClass="grid_10"
                                             readonly="#{managerEditarImovel.desabilitarEnderecoCorrespondencia and managerEditarImovel.usarMesmoEndereco}"
                                             value="#{managerEditarImovel.imovel.enderecoCorrespondencia.compl}" />

                            </p:panel>
                        </fieldset>

                        <br/>

                        <fieldset>
                            <legend>Georreferenciamento</legend>
                            <p:panel id="geoPanel" styleClass="container_24 clearfix ">

                                <p:gmap center="#{managerEditarImovel.center}" zoom="#{managerEditarImovel.zoom}" type="ROADMAP"
                                        rendered="#{!managerLayout.desabilitarMapa() and managerEditarImovel.connect}"
                                        styleClass="gmapImovel" model="#{managerEditarImovel.mapModel}" >

                                    <p:ajax event="stateChange" listener="#{managerEditarImovel.onStateChange}"/>
                                    <p:ajax event="pointSelect" update=":realtyForm:tabView:geoPanel" listener="#{managerEditarImovel.handlePointClick}" />
                                    <p:ajax event="markerDrag" listener="#{managerEditarImovel.onMarkerDrag}" update="@this"/>
                                </p:gmap>

                                <div style="float: left; margin-top: -37px; margin-left: 75px;">
                                    <p:commandButton value="Remover ponto" icon="ui-icon-trash" 
                                                     update=":realtyForm:tabView:geoPanel" process="@this"
                                                     rendered="#{!managerLayout.desabilitarMapa() and managerEditarImovel.connect}"
                                                     actionListener="#{managerEditarImovel.removerCoordenada()}"
                                                     style="font-size: 12px; width: 140px !important"
                                                     styleClass="ui-priority-primary" />
                                </div>

                                <p:outputLabel value="O Georreferenciamento foi desabilitado pois não foi possível estabelecer uma conexão com a Internet !"
                                               rendered="#{!managerLayout.desabilitarMapa() and !managerEditarImovel.connect}"/>

                                <p:outputLabel value="O Georreferenciamento foi desabilitado pelo administrador do sistema !"
                                               rendered="#{managerLayout.desabilitarMapa()}"/>

                            </p:panel>
                        </fieldset>

                    </p:tab>

                    <p:tab id="tab1" title="Sócio-Econômico">

                        <h4 class="title">Informações Sobre o Imóvel</h4>

                        <div class="clear"/>
                        <fieldset>
                            <legend>Patrimônio</legend>  

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.patrimonio}">
                                <f:selectItems value="#{managerUtilitario.patrimonioList}"  />
                                <p:ajax event="change" update=":realtyForm:tabView:patrimonioUniaoPanelGrid" 
                                        listener="#{managerEditarImovel.eventChangePatrimonioUniao()}" />
                            </p:selectOneRadio>
                        </fieldset>
                        <div class="clear-both"/>

                        <p:panel id="patrimonioUniaoPanelGrid" style="width: 102%; margin-left: -15px"
                                 styleClass="#{managerEditarImovel.imovel.patrimonio ne 'UNIAO' ? 'invisible' : 'panelGrid'} withoutBorder">
                            <fieldset>
                                <legend>Rip</legend>  

                                <p:outputLabel value="Número" styleClass="grid_3" for="codRip" />
                                <p:inputText id="codRip" styleClass="grid_19" value="#{managerEditarImovel.imovel.rip}" />
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Rip: é em nome do proprietário atual ?</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                                  value="#{managerEditarImovel.imovel.ripNomeCadastrado}" 
                                                  >
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>O proprietário é falecido ?</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                                  value="#{managerEditarImovel.imovel.titularFalecido}" >
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Qual o vínculo do atual proprietário com o cadastro na SPU ?</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" 
                                                  value="#{managerEditarImovel.imovel.vinculoTitularRip}" >
                                    <f:selectItems value="#{managerUtilitario.vinculoTitularRip}"/>
                                </p:selectOneRadio>
                            </fieldset>
                        </p:panel>


                        <fieldset>
                            <legend>Tipo de Documento</legend>  

                            <p:selectOneRadio styleClass="grid_3"  layout="pageDirection" value="#{managerEditarImovel.imovel.tipoDocumentoImovel}">
                                <f:selectItems value="#{managerUtilitario.tipoDocumentoImovel}"/>
                            </p:selectOneRadio>
                        </fieldset>

                        <div class="clear"/>

                        <fieldset>
                            <legend>Inquilino</legend>
                            <p:panel id="inquilinoPanel" styleClass="container_24 clearfix">

                                <div style="float: left;width: 100%;margin-bottom: 10px">
                                    <p:outputLabel value="Inquilino" styleClass="grid_3" for="inquilino"/>
                                    <p:autoComplete id="inquilino" styleClass="grid_20 autocompleteProprietario" dropdown="true" converter="proprietarioconverter"
                                                    var="inquilino"
                                                    itemLabel="#{inquilino.nome}"
                                                    style="margin-top: -2px"
                                                    itemValue="#{inquilino.nome.concat(' - ').concat(managerUtilitario.mascaraCpfCnpj(inquilino))}"
                                                    value="#{managerEditarImovel.inquilino}"
                                                    scrollHeight="200" forceSelection="true" immediate="true"
                                                    completeMethod="#{managerUtilitario.autocompletePessoaFisica}"/>
                                    <p:commandButton oncomplete="dlgProp.show()" icon="ui-icon-plus" style="margin-top: -1px"
                                                     update=":proprietarioForm" actionListener="#{managerProprietario.init()}"/>
                                    <div class="buttonAction">
                                        <p:commandButton value="Adicionar"
                                                         process="inquilinoPanel"
                                                         actionListener="#{managerEditarImovel.addInquilino()}"
                                                         update="inquilinoPanel, tableInquilino"
                                                         id="addInquilinoCommandButton" icon="ui-icon-plus"/>
                                    </div>
                                    <div class="clear"/> 
                                </div>

                                <p:dataTable id="tableInquilino" var="item" value="#{managerEditarImovel.imovel.inquilinos}" 
                                             styleClass="grid_24" emptyMessage="Nenhum registro">  
                                    <f:facet name="header">
                                        Nome do Inquilino
                                    </f:facet>

                                    <p:column headerText="Ação" width="50" style="text-align: center">
                                        <p:commandButton oncomplete="dlgProp.show()" icon="ui-icon-search"
                                                         update=":proprietarioForm">
                                            <f:setPropertyActionListener target="#{managerProprietario.proprietario}" value="#{item}" />
                                            <f:setPropertyActionListener target="#{managerProprietario.readonly}" value="#{true}" />
                                        </p:commandButton>
                                        <p:commandButton  styleClass="optionButton" alt="Remover"
                                                          update=":realtyForm:tabView:inquilinoPanel, tableInquilino"
                                                          process="@this" icon="ui-icon-trash"
                                                          actionListener="#{managerEditarImovel.removerInquilino(item)}" />
                                    </p:column>

                                    <p:column headerText="Nome">  
                                        #{item.tipoDocumento eq null or item.tipoDocumento eq 'CPF' ? item.nome : item.nomeFantasia}
                                    </p:column>

                                    <p:column headerText="Documento" width="60">
                                        #{managerUtilitario.mascaraCpfCnpj(inquilino)}
                                    </p:column> 

                                </p:dataTable>

                            </p:panel>
                        </fieldset>

                        <fieldset>
                            <legend>Possui registro de Imóvel?</legend> 

                            <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.regImovel}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>
                        </fieldset>
                        <div class="clear"/>
                    </p:tab>

                    <p:tab id="tab2" title="Caracteristicas">

                        <h4 class="title">Caracteristicas do Imóvel</h4>

                        <p:panel id="infGeralPanel"> 

                            <fieldset><legend>Tipo de Ocupação</legend>
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection"  value="#{managerEditarImovel.imovel.ocupacao}">
                                    <f:selectItems value="#{managerUtilitario.ocupacao}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Topografia do Terreno</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.topografia}">
                                    <f:selectItems value="#{managerUtilitario.topografia}"/>
                                </p:selectOneRadio>
                            </fieldset>

                            <div class="clear"/>
                            <fieldset><legend>Situação do Terreno</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.situacaoTerreno}">
                                    <f:selectItems value="#{managerUtilitario.situacaoTerreno}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Pedologia</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.pedologia}">
                                    <f:selectItems value="#{managerUtilitario.pedologia}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Utilização do Terreno</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.utilizacao}">
                                    <f:selectItems value="#{managerUtilitario.utilizacao}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Isento IPTU</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.isentoIptu}">
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Isento TSU</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.isentoTsu}">
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Uso do Imóvel</legend>      
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.usoImovel}">
                                    <f:selectItems value="#{managerUtilitario.usoImovel}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Observação</legend>      
                                <p:inputTextarea value="#{managerEditarImovel.imovel.obs}"/>

                            </fieldset>
                        </p:panel>
                        <div class="clear"/>

                    </p:tab>

                    <p:tab id="tab3" title="Edificação">

                        <h4 class="title">Informações Sobre a Edificação</h4>

                        <p:panel id="infEdificacaoPanel"> 
                            <fieldset><legend>Caracterização do Imóvel</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.caracterizacao}">
                                    <f:selectItems value="#{managerUtilitario.caracterizacao}"/>
                                </p:selectOneRadio>
                                <div class="clear"/>
                            </fieldset>
                            <fieldset><legend>Tipo de Revestimento Externo</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.revExterno}">
                                    <f:selectItems value="#{managerUtilitario.revExterno}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Piso</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.piso}">
                                    <f:selectItems value="#{managerUtilitario.piso}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Forro</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.forro}">
                                    <f:selectItems value="#{managerUtilitario.forro}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Cobertura</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.cobertura}">
                                    <f:selectItems value="#{managerUtilitario.cobertura}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Instalação Sanitária</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.instSanitaria}">
                                    <f:selectItems value="#{managerUtilitario.instSanitaria}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Posição do Imóvel</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.posicao}">
                                    <f:selectItems value="#{managerUtilitario.posicao}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Construção</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.tipoConstrucao}">
                                    <f:selectItems value="#{managerUtilitario.tipoConstrucao}"/>
                                </p:selectOneRadio>

                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Estrutura do Imóvel</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.estrutura}">
                                    <f:selectItems value="#{managerUtilitario.estrutura}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Estado de Conservação do Imóvel</legend>  
                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.estadoConservacao}">
                                    <f:selectItems value="#{managerUtilitario.estadoConservacao}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Tipo de Instalações Elétrica</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.instalacoesEletricas}">
                                    <f:selectItems value="#{managerUtilitario.instalacoesEletrica}"/>
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>
                            <fieldset><legend>Fachada</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.fachada}">
                                    <f:selectItems value="#{managerUtilitario.fachada}"/>
                                </p:selectOneRadio>
                            </fieldset>
                        </p:panel>
                        <div class="clear"/>

                    </p:tab>
                    <p:tab id="tab4" title="Serviços">

                        <h4 class="title">Serviços Urbanos</h4>

                        <p:panel id="servPanel"> 

                            <fieldset>
                                <legend>Tipo Pavimentação</legend>

                                <p:selectOneMenu id="tipoPavimentacao" panelStyle="width:150px;" style="width: 50% !important; margin-left: 60px"
                                                 value="#{managerEditarImovel.imovel.tipoPavimentacao}">
                                    <f:selectItem itemLabel="" itemValue="" />
                                    <f:selectItems value="#{managerUtilitario.tipoPavimentacao}"/>
                                </p:selectOneMenu>

                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Iluminação Pública</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.iluminacaoPublica}">
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Limpeza Pública</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.limpezaPublica}">
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Coleta de Lixo</legend>  

                                <p:selectOneRadio styleClass="grid_3" layout="pageDirection" value="#{managerEditarImovel.imovel.coletaLixo}">
                                    <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                    <f:selectItem itemLabel="Não" itemValue="false" />
                                </p:selectOneRadio>
                            </fieldset>
                        </p:panel> 
                        <div class="clear"/>

                    </p:tab>

                    <p:tab id="tabSPU" title="SPU">
                        <h4 class="title">SPU</h4>

                        <fieldset>
                            <legend>Sistema de água</legend>

                            <p:outputLabel value="Tipo" styleClass="grid_3" for="sistemaAgua" />
                            <p:selectOneMenu id="sistemaAgua" panelStyle="width:150px;" style="width: 50% !important; margin-left: 20px"
                                             value="#{managerEditarImovel.imovel.sistemaAgua}">
                                <f:selectItem itemLabel="" itemValue="" />
                                <f:selectItems value="#{managerUtilitario.sistemaAgua}"/>
                            </p:selectOneMenu>
                        </fieldset>

                        <fieldset>
                            <legend>Saneamento Basico</legend>

                            <p:outputLabel value="Tipo" styleClass="grid_3" for="saneamentoBasico" />
                            <p:selectOneMenu id="saneamentoBasico" panelStyle="width:150px;" style="width: 50% !important; margin-left: 20px"
                                             value="#{managerEditarImovel.imovel.saneamentoBasico}">
                                <f:selectItem itemLabel="" itemValue="" />
                                <f:selectItems value="#{managerUtilitario.saneamentoBasico}"/>
                            </p:selectOneMenu>
                        </fieldset>

                        <fieldset>
                            <legend>Recebe outro benefício do Governo Federeal</legend>

                            <p:selectOneRadio styleClass="grid_3" value="#{managerEditarImovel.imovel.recebeOutroBeneficioGovernoFederal}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                            </p:selectOneRadio>
                        </fieldset>

                        <fieldset>
                            <legend>Pessoas com necessidades especiais</legend>

                            <p:selectOneRadio styleClass="grid_3" value="#{managerEditarImovel.imovel.pessoasComNecessidadesEspeciais}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                                <p:ajax event="change" update="pessoaNecessidadeEspecialPanel" />
                            </p:selectOneRadio>

                            <p:panel id="pessoaNecessidadeEspecialPanel" styleClass="container_24"
                                     style="#{managerEditarImovel.imovel.pessoasComNecessidadesEspeciais eq false or 
                                              managerEditarImovel.imovel.pessoasComNecessidadesEspeciais eq null ? 'display: none' : ''}">

                                <p:outputLabel styleClass="grid_3 pessoaNecessidadeEspecialQuantidadeLabel" value="Quantidade" 
                                               for="pessoaNecessidadeEspecialQuantidade" />
                                <p:inputText id="pessoaNecessidadeEspecialQuantidade" styleClass="grid_4" 
                                             value="#{managerEditarImovel.imovel.pessoasComNecessidadesEspeciaisQuantidade}"/>

                            </p:panel>
                        </fieldset>

                        <fieldset>
                            <legend>Pessoas com morbidade</legend>

                            <p:selectOneRadio styleClass="grid_3" value="#{managerEditarImovel.imovel.pessoasComMorbidade}">
                                <f:selectItem itemLabel="Sim" itemValue="true" /> 
                                <f:selectItem itemLabel="Não" itemValue="false" />
                                <p:ajax event="change" update="pessoaMorbidadePanel" />
                            </p:selectOneRadio>

                            <p:panel id="pessoaMorbidadePanel" styleClass="container_24"
                                     style="#{managerEditarImovel.imovel.pessoasComMorbidade eq false or 
                                              managerEditarImovel.imovel.pessoasComMorbidade eq null ? 'display: none' : ''}">

                                <p:outputLabel styleClass="grid_5 alpha pessoaMorbidadeTipoLabel" value="Tipo" for="pessoaMorbidadeTipo" />
                                <p:inputText id="pessoaMorbidadeTipo" styleClass="grid_10" 
                                             value="#{managerEditarImovel.imovel.pessoasComMorbidadeTipo}"/>

                            </p:panel>
                        </fieldset>

                    </p:tab>

                    <p:tab id="tab5" title="Dimensões">
                        <h5 class="title">Dimensões e Confrontações</h5>

                        <p:panel id="dimenPanel" styleClass="container_24 clearfix withoutBorder"> 
                            <fieldset>
                                <legend>Frente</legend>

                                <p:outputLabel value="Para" styleClass="grid_3" for="frenteInputText" />
                                <p:inputText id="frenteInputText" styleClass="grid_18"
                                             value="#{managerEditarImovel.imovel.frente}" />
                                <div class="clear"/>

                                <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="frenteRuaInputText" />
                                <p:inputText id="frenteRuaInputText" styleClass="grid_18"
                                             value="#{managerEditarImovel.imovel.frenteRua}" />
                                <p:commandButton id="frenteNotice" icon="ui-icon-notice" 
                                                 rendered="#{!managerEditarImovel.frente.isEmpty() or managerEditarImovel.frente ne null}"
                                                 oncomplete="dlgFrente.show()"/>
                                <div class="clear"/>

                                <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="frenteMedInputText" />
                                <p:inputText id="frenteMedInputText" styleClass="grid_18"
                                             value="#{managerEditarImovel.imovel.frenteMedindo}" 
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                    <p:ajax event="blur" update=":realtyForm:tabView:frenteMedindoLinhasQuebradas"/>
                                </p:inputText>

                                <p:selectBooleanButton id="frenteMedindoLinhasQuebradas" styleClass="booleanButtonLinhaQuebrada"
                                                       onIcon="ui-icon-grip-dotted-vertical"
                                                       offIcon="ui-icon-grip-dotted-vertical"
                                                       value="#{managerEditarImovel.imovel.frenteMedindoEmLinhasQuebradas}"
                                                       onLabel="." offLabel="." 
                                                       style="#{managerEditarImovel.imovel.frenteMedindo ne null ? 'width:60px' : 'display: none'}"/>
                                <p:tooltip for="frenteMedindoLinhasQuebradas" value="Linhas quebradas !"/>
                                <div class="clear"/>
                            </fieldset>

                            <fieldset>
                                <legend>Lado Direito</legend>

                                <p:outputLabel value="Para" styleClass="grid_3" for="direitoParaInputText" />
                                <p:inputText id="direitoParaInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoDireito}" />
                                <div class="clear"/>

                                <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="direitoRuaInputText" />
                                <p:inputText id="direitoRuaInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoDireitoRua}" />
                                <p:commandButton id="ladoDireitoNotice" icon="ui-icon-notice" 
                                                 rendered="#{!managerEditarImovel.ladoDireito.isEmpty()}"
                                                 oncomplete="dlgLadoDireito.show()"/>
                                <div class="clear"/>

                                <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="direitoMedInputText" />
                                <p:inputText id="direitoMedInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoDireitoMedindo}" 
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                    <p:ajax event="change" update=":realtyForm:tabView:ladoDireitoMedindoLinhasQuebradas"/>
                                </p:inputText>

                                <p:selectBooleanButton id="ladoDireitoMedindoLinhasQuebradas" styleClass="booleanButtonLinhaQuebrada"
                                                       onIcon="ui-icon-grip-dotted-vertical"
                                                       offIcon="ui-icon-grip-dotted-vertical"
                                                       value="#{managerEditarImovel.imovel.ladoDireitoMedindoEmLinhasQuebradas}"
                                                       onLabel="." offLabel="." 
                                                       style="#{managerEditarImovel.imovel.ladoDireitoMedindo ne null ? 'width:60px' : 'display: none'}"/>
                                <p:tooltip for="ladoDireitoMedindoLinhasQuebradas" value="Linhas quebradas !"/>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Lado Esquerdo</legend>

                                <p:outputLabel value="Para" styleClass="grid_3" for="esquerdoInputText" />
                                <p:inputText id="esquerdoInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoEsquerdo}" />
                                <div class="clear"/>

                                <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="esquerdoRuaInputText" />
                                <p:inputText id="esquerdoRuaInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoEsquerdoRua}" />
                                <p:commandButton id="ladoDireitoEsquerdo" icon="ui-icon-notice" 
                                                 rendered="#{!managerEditarImovel.ladoEsquerdo.isEmpty()}"
                                                 oncomplete="dlgLadoEsquerdo.show()"/>
                                <div class="clear"/>

                                <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="esquerdoMedInputText" />
                                <p:inputText id="esquerdoMedInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.ladoEsquerdoMedindo}" 
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                    <p:ajax event="change" update=":realtyForm:tabView:ladoEsquerdoMedindoLinhasQuebradas"/>
                                </p:inputText>

                                <p:selectBooleanButton id="ladoEsquerdoMedindoLinhasQuebradas" styleClass="booleanButtonLinhaQuebrada"
                                                       onIcon="ui-icon-grip-dotted-vertical"
                                                       offIcon="ui-icon-grip-dotted-vertical"
                                                       value="#{managerEditarImovel.imovel.ladoEsquerdoMedindoEmLinhasQuebradas}"
                                                       onLabel="." offLabel="." 
                                                       style="#{managerEditarImovel.imovel.ladoEsquerdoMedindo ne null ? 'width:60px' : 'display: none'}"/>
                                <p:tooltip for="ladoEsquerdoMedindoLinhasQuebradas" value="Linhas quebradas !"/>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Fundo</legend>

                                <p:outputLabel value="Para" styleClass="grid_3" for="fundoInputText" />
                                <p:inputText id="fundoInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.fundo}" />
                                <div class="clear"/>

                                <p:outputLabel value="Limitando" styleClass="grid_3 dimensaoLabelImovel" for="fundoRuaInputText" />
                                <p:inputText id="fundoRuaInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.fundoRua}" />
                                <div class="clear"/>

                                <p:outputLabel value="Medindo" styleClass="grid_3 dimensaoLabelImovel" for="fundoMedInputText" />
                                <p:inputText id="fundoMedInputText" styleClass="grid_18" 
                                             value="#{managerEditarImovel.imovel.fundoMedindo}" 
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                    <p:ajax event="blur" update=":realtyForm:tabView:fundoMedindoLinhasQuebradas"/>
                                </p:inputText>

                                <p:selectBooleanButton id="fundoMedindoLinhasQuebradas" styleClass="booleanButtonLinhaQuebrada"
                                                       onIcon="ui-icon-grip-dotted-vertical"
                                                       offIcon="ui-icon-grip-dotted-vertical"
                                                       value="#{managerEditarImovel.imovel.fundoMedindoEmLinhasQuebradas}"
                                                       onLabel="." offLabel="." 
                                                       style="#{managerEditarImovel.imovel.fundoMedindo ne null ? 'width:60px' : 'display: none'}"/>
                                <p:tooltip for="fundoMedindoLinhasQuebradas" value="Linhas quebradas !"/>

                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Dimensões Terreno</legend>  

                                <p:outputLabel value="Área Terreno" styleClass="grid_5" for="areaInputText" />
                                <p:inputText id="areaInputText" styleClass="grid_4" 
                                             value="#{managerEditarImovel.imovel.dimensoes.areaTerreno}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <p:outputLabel value="Área Unidade" styleClass="grid_5" for="areaUInputText" />
                                <p:inputText id="areaUInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.areaUnidade}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <div class="clear"/>
                                <p:outputLabel value="Área Total" styleClass="grid_5" for="areaTInputText" />
                                <p:inputText id="areaTInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.areaTotalEdificacao}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <p:outputLabel value="Perímetro" styleClass="grid_5" for="perimetroInputText" />
                                <p:inputText id="perimetroInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.perimetro}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <div class="clear"/>
                                <p:outputLabel value="N˚Pavimento" styleClass="grid_5" for="areaPInputText" />
                                <p:inputText id="areaPInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.numPavimentacaoEdific}">
                                </p:inputText>
                            </fieldset>
                            <div class="clear"/>

                            <fieldset>
                                <legend>Faces de Quadra</legend>

                                <p:panel id="faceQuadraAvancadoDados" styleClass="container_24 clearfix">

                                    <p:outputLabel value="Bairro" styleClass="grid_3" for="bairro"/>
                                    <p:autoComplete id="bairro" styleClass="grid_20" dropdown="true" converter="bairroconverter"
                                                    var="bairro" itemLabel="#{bairro.nome}" style="margin-top: -2px"
                                                    itemValue="#{bairro}" value="#{managerEditarImovel.bairro}"
                                                    scrollHeight="200" forceSelection="true"
                                                    completeMethod="#{managerEditarImovel.autocompleteBairroFaceQuadra}">
                                        <p:ajax event="itemSelect" update=":realtyForm:tabView:logradouro" />
                                    </p:autoComplete>

                                    <p:outputLabel value="Logradouro" styleClass="grid_3 logradouroLabelFaceQuadra" for="logradouro"/>
                                    <p:autoComplete id="logradouro" styleClass="grid_20" dropdown="true" converter="facequadraconverter"
                                                    var="face" itemLabel="#{face.dne.rua}" style="margin-top: -2px"
                                                    itemValue="#{face}" value="#{managerEditarImovel.faceQuadra}"
                                                    scrollHeight="200" forceSelection="true" immediate="true"
                                                    completeMethod="#{managerEditarImovel.autocompleteFaceQuadra}"/>
                                    <div class="clear"/>

                                    <div class="buttonAction">
                                        <p:commandButton value="Adicionar"
                                                         actionListener="#{managerEditarImovel.addFaceQuadra()}"
                                                         update=":realtyForm:tabView:faceQuadraTable, :realtyForm:tabView:bairro, :realtyForm:tabView:logradouro"/>
                                        <p:commandButton value="Limpar" icon="ui-icon-clean"
                                                         actionListener="#{managerEditarImovel.limparFaceQuadra()}"
                                                         update=":realtyForm:tabView:bairro, :realtyForm:tabView:logradouro" process="@this" />
                                    </div>
                                    
                                    <br/>


                                    <p:dataTable id="faceQuadraTable" var="item" value="#{managerEditarImovel.imovel.faceQuadras}" 
                                                 styleClass="grid_24" rowIndexVar="rowid"
                                                 rows="5" paginator="true" lazy="true"   
                                                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                                 currentPageReportTemplate="{currentPage} de {totalPages}"
                                                 paginatorPosition="bottom" emptyMessage="Nenhum registro encontrado"
                                                 style="white-space: pre-wrap;">

                                        <f:facet name="header">Faces de Quadra</f:facet>
                                        <p:column headerText="Ação" width="90">
                                            <p:commandButton  styleClass="optionButton" alt="Remover"
                                                              update=":realtyForm:tabView:faceQuadraTable"
                                                              process="@this" icon="ui-icon-trash"
                                                              actionListener="#{managerEditarImovel.removerFaceQuadra(item)}" />
                                        </p:column>

                                        <p:column headerText="Setor" width="50">
                                            <h:outputText value="#{item.quadra.setor.numero}"/>
                                        </p:column>
                                        <p:column headerText="Quadra" width="50">
                                            <h:outputText value="#{item.quadra.numero}"/>
                                        </p:column>
                                        <p:column headerText="UFMP" width="90">
                                            <h:outputText value="#{item.valorUfmp}"/>
                                        </p:column>
                                        <p:column headerText="Bairro">
                                            <h:outputText value="#{item.dne.bairro.nome}"/>
                                        </p:column>
                                        <p:column headerText="Logradouro">
                                            <h:outputText value="#{item.dne.rua}"/>
                                        </p:column>

                                    </p:dataTable>

                                </p:panel>
                            </fieldset>

                            <fieldset>
                                <legend>Testada</legend>

                                <p:outputLabel value="Testada do Imóvel"  styleClass="grid_7" for="areaTiInputText" />
                                <p:inputText id="areaTiInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.testadaImovel}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <p:outputLabel value="Servida Conservação Calçamento"  styleClass="grid_8" for="areaTSInputText" />
                                <p:inputText id="areaTSInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.testadaServidaConservCalcamento}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <div class="clear"/>
                                <p:outputLabel value="Servida Iluminação Pública"  styleClass="grid_7" for="areaTIInputText" />
                                <p:inputText id="areaTIInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.testadaServidaPorIluminacaoPublica}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>

                                <p:outputLabel value="Servida Limpeza Pública" styleClass="grid_8" for="areaTLInputText" />
                                <p:inputText id="areaTLInputText" styleClass="grid_4"
                                             value="#{managerEditarImovel.imovel.dimensoes.testadaServidaLimpezaPublica}"
                                             onkeypress="jQuery(this).autoNumeric({aSep: '.', aDec: ','} );">
                                    <f:convertNumber pattern="#,###,##0.00" locale="pt,BR"/>
                                </p:inputText>
                            </fieldset>
                        </p:panel>

                        <p:dialog id="dlgFrente" width="640" widgetVar="dlgFrente" modal="true" 
                                  header="Sugestão do confrontante" styleClass="container_24 clearfix" 
                                  closeOnEscape="true" closable="false" resizable="false" >

                            <h:outputText value="#{managerEditarImovel.frente}" styleClass="grid_23" 
                                          style="white-space: pre-wrap;" />

                            <div class="buttonAction">
                                <p:commandButton value="Sim" actionListener="#{managerEditarImovel.setDimensaoFrente()}"
                                                 update=":realtyForm:tabView:frenteRuaInputText"
                                                 oncomplete="dlgFrente.hide()" icon="ui-icon-check"/>
                                <p:commandButton value="Não" icon="ui-icon-close" oncomplete="dlgFrente.hide()" />
                            </div>
                        </p:dialog>
                        <p:dialog id="dlgLadoDireito" width="640" widgetVar="dlgLadoDireito" modal="true" 
                                  header="Sugestão do confrontante" styleClass="container_24 clearfix" 
                                  closeOnEscape="true" closable="false" resizable="false" >

                            <h:outputText value="#{managerEditarImovel.ladoDireito}" styleClass="grid_23" 
                                          style="white-space: pre-wrap;" />

                            <div class="buttonAction">
                                <p:commandButton value="Sim" actionListener="#{managerEditarImovel.setDimensaoLadoDireito()}"
                                                 update=":realtyForm:tabView:direitoRuaInputText"
                                                 oncomplete="dlgLadoDireito.hide()" icon="ui-icon-check"/>
                                <p:commandButton value="Não" icon="ui-icon-close" oncomplete="dlgLadoDireito.hide()" />
                            </div>
                        </p:dialog>
                        <p:dialog id="dlgLadoEsquerdo" width="640" widgetVar="dlgLadoEsquerdo" modal="true" 
                                  header="Sugestão do confrontante" styleClass="container_24 clearfix" 
                                  closeOnEscape="true" closable="false" resizable="false" >

                            <h:outputText value="#{managerEditarImovel.ladoEsquerdo}" styleClass="grid_23" 
                                          style="white-space: pre-wrap;" />

                            <br/>
                            <div class="buttonAction">
                                <p:commandButton value="Sim" actionListener="#{managerEditarImovel.setDimensaoLadoEsquerdo()}"
                                                 update=":realtyForm:tabView:esquerdoRuaInputText"
                                                 oncomplete="dlgLadoEsquerdo.hide()" icon="ui-icon-check"/>
                                <p:commandButton value="Não" icon="ui-icon-close" oncomplete="dlgLadoEsquerdo.hide()" />
                            </div>
                        </p:dialog>

                        <fieldset>
                            <legend>Inserir Dados das Coordenadas</legend>

                            <p:panel id="georefPanel" styleClass="container_24 clearfix withoutBorder">
                                <p:gmap rendered="#{!managerLayout.desabilitarMapa() and managerEditarImovel.connect}"
                                        center="#{managerEditarImovel.centerDimensao}" 
                                        zoom="#{managerEditarImovel.zoomDimensao}" type="HYBRID"
                                        styleClass="gmapImovel" model="#{managerEditarImovel.mapModelDimensao}">

                                    <p:ajax event="stateChange" listener="#{managerEditarImovel.onStateChangeDimensao}"/>
                                    <p:ajax event="pointSelect" listener="#{managerEditarImovel.handlePointClickDimensao}" 
                                            update=":realtyForm:tabView:georefPanel, :realtyForm:tabView:georefCoordenadasPanel"/>
                                    <p:ajax event="markerDrag" listener="#{managerEditarImovel.onMarkerDragDimensao}"
                                            update=":realtyForm:tabView:georefPanel, :realtyForm:tabView:georefCoordenadasPanel"/>

                                    <p:ajax event="overlaySelect" listener="#{managerEditarImovel.visualizarCoordenadaMapa}"/>

                                    <p:gmapInfoWindow id="infoWindow">
                                        <p:outputPanel style="display: block; margin: auto; width: 110px">

                                            <p:outputLabel value="Ponto" for="pontoTexto" style="font-weight: bold; color: #737373" />
                                            <p:outputLabel id="pontoTexto" value="#{'  '.concat(managerEditarImovel.visualizarCoordenada.ponto)}" />
                                            <div class="clear"/>

                                            <p:outputLabel value="N" for="norteTexto" style="font-weight: bold; color: #737373"/>
                                            <p:outputLabel id="norteTexto" value="#{'  '.concat(managerEditarImovel.visualizarCoordenada.convN)}" />
                                            <div class="clear"/>

                                            <p:outputLabel value="E" for="lesteTexto" style="font-weight: bold; color: #737373"/>
                                            <p:outputLabel id="lesteTexto" value="#{'  '.concat(managerEditarImovel.visualizarCoordenada.convE)}" />
                                            <div class="clear"/>

                                            <p:outputLabel value="Distância" for="disTexto" style="font-weight: bold; color: #737373"/>
                                            <p:outputLabel id="disTexto" value="#{'  '.concat(managerEditarImovel.visualizarCoordenada.distancia)}" />
                                            <div class="clear"/>

                                            <p:outputLabel value="Limite" for="limTexto" style="font-weight: bold; color: #737373"/>
                                            <p:outputLabel id="limTexto" value="#{'  '.concat(managerEditarImovel.visualizarCoordenada.limite)}" />
                                            <div class="clear"/>

                                            <div style="float: right; margin-right: -10px; right: 0; position: absolute;" >
                                                <p:commandLink title="Editar" style="font-size: 1.33333em !important"
                                                               disabled="#{managerEditarImovel.editandoCoordenada}"
                                                               styleClass="fa fa-pencil-square-o fa-lg acaorapida" process="@this"
                                                               actionListener="#{managerEditarImovel.editarCoordenada(managerEditarImovel.visualizarCoordenada)}"
                                                               update=":realtyForm:tabView:georefPanel, 
                                                               :realtyForm:tabView:georefCoordenadasPanel
                                                               :realtyForm:tabView:coordenadaAvancadoDados"/>

                                                <p:commandLink title="Remover" style="font-size: 1.33333em !important"
                                                               disabled="#{managerEditarImovel.editandoCoordenada}"
                                                               styleClass="fa fa-trash-o fa-lg acaorapida" process="@this"
                                                               actionListener="#{managerEditarImovel.setCoordenadaRemover(managerEditarImovel.visualizarCoordenada)}"
                                                               oncomplete="dlgCoordenada.show()"/>
                                            </div>
                                            <br/>

                                        </p:outputPanel>
                                    </p:gmapInfoWindow>

                                </p:gmap>

                                <div style="float: left; margin-top: -37px; margin-left: 75px;">
                                    <p:commandButton value="Remover pontos" icon="ui-icon-trash" 
                                                     rendered="#{!managerLayout.desabilitarMapa() and managerEditarImovel.connect}"
                                                     update=":realtyForm:tabView:georefPanel
                                                     :realtyForm:tabView:georefCoordenadasPanel
                                                     :realtyForm:tabView:coordenadaAvancadoDados"
                                                     process="@this" 
                                                     actionListener="#{managerEditarImovel.removerPontosCoordenadaDimensao()}"
                                                     style="font-size: 12px; width: 140px !important"
                                                     styleClass="ui-priority-primary" />
                                </div>

                                <p:outputLabel value="O Georreferenciamento foi desabilitado pois não foi possível estabelecer uma conexão com a Internet !"
                                               rendered="#{!managerLayout.desabilitarMapa() and !managerEditarImovel.connect}"/>

                                <p:outputLabel value="O Georreferenciamento foi desabilitado pelo administrador do sistema !"
                                               rendered="#{managerLayout.desabilitarMapa()}"/>
                            </p:panel>

                            <p:panel id="coordenadaAvancadoDados" styleClass="container_24 clearfix" header="Avançado"
                                     toggleable="true" collapsed="#{managerEditarImovel.panelCollapsed}" >

                                <p:outputLabel value="Ponto" styleClass="grid_3" for="pontoText" />
                                <p:inputText id="pontoText" styleClass="grid_19" value="#{managerEditarImovel.coordenada.ponto}" />
                                <div class="clear"/>

                                <p:outputLabel value="N" styleClass="grid_3" for="norteText">
                                    <span class="ui-outputlabel-rfi required">*</span>
                                </p:outputLabel>
                                <p:inputText id="norteText" styleClass="grid_8" 
                                             value="#{managerEditarImovel.coordenada.convN}" />

                                <p:outputLabel value="E" styleClass="grid_3 alpha distanciaLabelImovel" for="lesteText">
                                    <span class="ui-outputlabel-rfi required">*</span>
                                </p:outputLabel>
                                <p:inputText id="lesteText" styleClass="grid_8" 
                                             value="#{managerEditarImovel.coordenada.convE}" />
                                <div class="clear"/>

                                <p:outputLabel value="Azimute" styleClass="grid_3" for="azimuteText" />
                                <p:inputText id="azimuteText" styleClass="grid_8" value="#{managerEditarImovel.coordenada.azimute}" />

                                <p:outputLabel value="Distância" styleClass="grid_3 alpha distanciaLabelImovel" for="disText" />
                                <p:inputText id="disText" styleClass="grid_8" value="#{managerEditarImovel.coordenada.distancia}" />

                                <p:outputLabel value="Limite" styleClass="grid_3" for="limText" />
                                <p:inputTextarea id="limText"  styleClass="grid_19" value="#{managerEditarImovel.coordenada.limite}" />
                                <br/>
                                <br/>
                                <div class="buttonAction">
                                    <p:commandButton id="bt_add" value="Adicionar" icon="ui-icon-plus"
                                                     process=":realtyForm:tabView:coordenadaAvancadoDados @this"
                                                     actionListener="#{managerEditarImovel.adicionarCoordenada()}"
                                                     styleClass="ui-priority-primary"/>

                                    <p:commandButton id="bt_clear" value="Limpar" icon="ui-icon-clean"
                                                     process="@this" rendered="#{!managerEditarImovel.editandoCoordenada}"
                                                     update=":realtyForm:tabView:coordenadaAvancadoDados">
                                        <p:resetInput target=":realtyForm:tabView:coordenadaAvancadoDados" />
                                    </p:commandButton>

                                    <p:commandButton id="bt_cancelar" value="Cancelar" icon="ui-icon-close"
                                                     update=":realtyForm:tabView:georefPanel, 
                                                     :realtyForm:tabView:georefCoordenadasPanel,
                                                     :realtyForm:tabView:coordenadaAvancadoDados"
                                                     process="@this"
                                                     rendered="#{managerEditarImovel.editandoCoordenada}"
                                                     actionListener="#{managerEditarImovel.adicionarCoordenada()}"/>
                                </div>

                            </p:panel>

                            <p:panel id="georefCoordenadasPanel" styleClass="container_24 clearfix withoutBorder">

                                <p:blockUI id="BLOCK" block="tableGeo" trigger="bt_add" > 
                                    <p:graphicImage value="media/images/ajax-loader.gif"/>
                                </p:blockUI> 

                                <p:dataTable id="tableGeo" var="item" value="#{managerEditarImovel.imovel.coordenadasDimensoes}" 
                                             styleClass="grid_24" rowIndexVar="rowid"
                                             rowKey="#{item.id}" rows="5" paginator="true"  
                                             paginatorPosition="bottom" emptyMessage="Nenhum registro">  
                                    <f:facet name="header">
                                        Coordenadas
                                    </f:facet>
                                    <p:column headerText="Ação" width="60">
                                        <p:commandButton title="Editar" 
                                                         icon="ui-icon-pencil" process="@this" 
                                                         disabled="#{managerEditarImovel.editandoCoordenada}"
                                                         update=":realtyForm:tabView:georefPanel
                                                         :realtyForm:tabView:georefCoordenadasPanel
                                                         :realtyForm:tabView:coordenadaAvancadoDados"
                                                         actionListener="#{managerEditarImovel.editarCoordenada(item)}"/>
                                        <p:commandButton title="Visualizar"
                                                         oncomplete="dlgVisu.show();" process="@this"
                                                         update=":dlgVisuForm, @this"
                                                         actionListener="#{managerEditarImovel.visualizarCoordenada(item)}"
                                                         icon="ui-icon-zoomin"/>
                                        <p:commandButton update="@this" title="Excluir" process="@this"
                                                         oncomplete="dlgCoordenada.show()" disabled="#{managerEditarImovel.editandoCoordenada}"
                                                         icon="ui-icon-trash" >
                                            <f:setPropertyActionListener target="#{managerEditarImovel.coordenadaRemover}" value="#{item}" />
                                        </p:commandButton>
                                    </p:column>

                                    <p:column headerText="Ponto" width="150">  

                                        <h:outputText value="#{item.ponto}"/>

                                    </p:column>
                                    <p:column headerText="N UTM" width="150">  

                                        <h:outputText value="#{item.convN}"/>

                                    </p:column>
                                    <p:column headerText="E UTM" width="100">  

                                        <h:outputText value="#{item.convE}"/>

                                    </p:column> 

                                </p:dataTable>
                            </p:panel>
                        </fieldset>

                    </p:tab>

                    <p:tab id="tab6" title="Documentos">
                        <h4 class="title">Documentos</h4>

                        <p:panel id="documentoPanel" styleClass="container_24 clearfix withoutBorder">
                            <p:fileUpload 
                                mode="advanced"
                                label="Anexar"
                                uploadLabel="Enviar"
                                cancelLabel="Cancelar"
                                fileUploadListener="#{managerEditarImovel.adicionarAnexo}"
                                multiple="false"
                                auto="true"
                                allowTypes="/(\.|\/)(gif|jpe?g|png|pdf)$/"
                                dragDropSupport="true"
                                invalidFileMessage="Tipo de arquivo não suportado."
                                invalidSizeMessage="Tamanho do arquivo não é suportado"
                                immediate="true"
                                update=":realtyForm:tabView:documentoPanel, :realtyForm:tabView:dlgAnexo" />

                            <fieldset>
                                <legend>Anexos</legend>

                                <div class="my-simple-gallery" data-pswp-uid="1" >
                                    <ui:repeat  value="#{managerEditarImovel.imovel.annex}" var="a">
                                        <h:panelGroup rendered="#{!managerImagem.pdf(a)}" >
                                            <div class="grid_4">
                                                <p:commandButton id="removeButton" alt="Remover" styleClass="ui-button-only button-remove"
                                                                 style="margin-right: -17px !important;"
                                                                 icon="ui-icon-trash" update=":realtyForm:tabView:documentoPanel" 
                                                                 process=":realtyForm:tabView:documentoPanel"
                                                                 actionListener="#{managerEditarImovel.removerAnexo(a)}" />
                                                <p:commandButton id="editarButton" alt="Editar" styleClass="ui-button-only button-edit"
                                                                 icon="ui-icon-pencil" 
                                                                 update=":realtyForm:tabView:documentoPanel, :realtyForm:tabView:dlgEditarAnexo" 
                                                                 process=":realtyForm:tabView:documentoPanel" oncomplete="dlgEditarAnexo.show();"
                                                                 actionListener="#{managerEditarImovel.editarAnexo(a)}" />
                                                <p:commandButton id="restaurarButton" alt="Restaurar" styleClass="ui-button-only button-restore"
                                                                 icon="ui-icon-newwin" 
                                                                 rendered="#{a.editado and a.id ne null}"
                                                                 onclick="dlgRestImagem.show()">
                                                    <f:setPropertyActionListener target="#{managerImagem.idAnexo}" value="#{a.id}"/>
                                                </p:commandButton>
                                                <figure itemprop="associatedMedia" style="width: 100%"
                                                        onclick="initPhoto(); habilitaEdicaoImagem(); processPanelGaleria();">
                                                    <a href="#{managerImagem.urlImagem(a)}" 
                                                       itemprop="contentUrl" data-size="#{managerImagem.widthHeight(a)}" pid="#{a.id}">
                                                        <img src="#{managerImagem.urlThumbnailImagem(a)}" 
                                                             itemprop="thumbnail" class="image"/>
                                                    </a>
                                                    <figcaption itemprop="caption description">#{a.nomeExibicao}</figcaption>
                                                </figure>
                                            </div>
                                        </h:panelGroup>
                                    </ui:repeat>
                                    <ui:repeat  value="#{managerEditarImovel.imovel.annex}" var="a">
                                        <h:panelGroup rendered="#{managerImagem.pdf(a)}" >
                                            <div class="grid_4">
                                                <p:commandButton id="removeButton" alt="Remover" styleClass="ui-button-only button-remove"
                                                                 style="margin-right: -17px !important;"
                                                                 icon="ui-icon-trash" update=":realtyForm:tabView:documentoPanel" 
                                                                 process=":realtyForm:tabView:documentoPanel"
                                                                 actionListener="#{managerEditarImovel.removerAnexo(a)}" />
                                                <p:commandButton id="editarButton" alt="Editar" styleClass="ui-button-only button-edit"
                                                                 icon="ui-icon-pencil" 
                                                                 update=":realtyForm:tabView:documentoPanel, :realtyForm:tabView:dlgEditarAnexo" 
                                                                 process=":realtyForm:tabView:documentoPanel" oncomplete="dlgEditarAnexo.show();"
                                                                 actionListener="#{managerEditarImovel.editarAnexo(a)}" />
                                                <h:outputLink value="#{managerImagem.visualizarPdf(a)}" rendered="#{managerImagem.pdf(a)}"
                                                              title="#{a.nomeExibicao}" target="_blank">
                                                    <p:graphicImage styleClass="image grid_3 anexoImovel" url="#{managerImagem.urlPDF}"/>
                                                </h:outputLink>
                                            </div>
                                        </h:panelGroup>
                                    </ui:repeat>

                                </div>
                                <p:remoteCommand name="processPanelGaleria" update=":realtyForm:tabView:documentoPanel" process=":realtyForm:tabView:documentoPanel" />
                            </fieldset>

                        </p:panel>

                        <p:dialog id="dlgAnexo" width="640" widgetVar="dlgAnexo" modal="true"
                                  header="Anexo" styleClass="container_24 clearfix" draggable="false"
                                  closeOnEscape="true" closable="false" resizable="false" >

                            <p:outputLabel value="Nome" styleClass="grid_3" for="nomeAnexo"/>
                            <p:inputText id="nomeAnexo" value="#{managerEditarImovel.anexo.nomeExibicao}" styleClass="grid_20"/>
                            <div class="clear"/>

                            <p:outputLabel value="Tipo" styleClass="grid_3" for="tipoAnexo" />
                            <div class="grid_20">
                                <p:selectOneMenu id="tipoAnexo" panelStyle="width:150px;"
                                                 value="#{managerEditarImovel.anexo.tipoAnexo}">
                                    <f:selectItem itemLabel="" itemValue="" />
                                    <f:selectItems value="#{managerUtilitario.tipoAnexo}"/>
                                </p:selectOneMenu>
                            </div>
                            <div class="clear"/>

                            <div class="buttonAction">
                                <p:commandButton value="Adicionar" actionListener="#{managerEditarImovel.adicionarAnexo()}"
                                                 update=":realtyForm:tabView:documentoPanel"
                                                 process=":realtyForm:tabView:dlgAnexo"
                                                 oncomplete="dlgAnexo.hide();" icon="ui-icon-check"/>
                                <p:commandButton value="Cancelar" actionListener="#{managerEditarImovel.removerAnexo()}"
                                                 oncomplete="dlgAnexo.hide();" icon="ui-icon-close"/>
                            </div>

                            <script>
                                $(document).ready(function() {
                                    $('#realtyForm\\:tabView\\:tipoAnexo_panel').removeAttr('style');
                                    $('#realtyForm\\:tabView\\:tipoAnexo_panel').css('width', 510);
                                    $('#realtyForm\\:tabView\\:tipoAnexo_panel').addClass('selectOneMenuFixo');
                                    $('#realtyForm\\:tabView\\:tipoAnexo_panel').addClass('zIndex9999');
                                });
                            </script>

                        </p:dialog>

                        <p:dialog id="dlgEditarAnexo" width="640" widgetVar="dlgEditarAnexo" modal="true" 
                                  header="Anexo" styleClass="container_24 clearfix" 
                                  closeOnEscape="true" closable="false" resizable="false" >

                            <p:outputLabel value="Nome" styleClass="grid_3" for="nomeAnexoEditar"/>
                            <p:inputText id="nomeAnexoEditar" value="#{managerEditarImovel.anexo.nomeExibicao}" styleClass="grid_20"/>
                            <div class="clear"/>


                            <p:outputLabel value="URL" styleClass="grid_3" for="nomeAnexo"/>
                            <p:inputText id="urlAnexoEditar" value="#{managerEditarImovel.anexo.nome}" styleClass="grid_20"/>
                            <div class="clear"/>

                            <p:outputLabel value="Tipo" styleClass="grid_3" for="tipoAnexoEditar" />
                            <div class="grid_20">
                                <p:selectOneMenu id="tipoAnexoEditar" panelStyle="width:150px;" 
                                                 value="#{managerEditarImovel.anexo.tipoAnexo}">
                                    <f:selectItem itemLabel="" itemValue="" />
                                    <f:selectItems value="#{managerUtilitario.tipoAnexo}"/>
                                </p:selectOneMenu>
                            </div>
                            <div class="clear"/>

                            <div class="buttonAction">
                                <p:commandButton value="Salvar" actionListener="#{managerEditarImovel.atualizarAnexo}"
                                                 update=":realtyForm:tabView:documentoPanel"
                                                 oncomplete="dlgEditarAnexo.hide();" icon="ui-icon-check"/>
                                <p:commandButton value="Cancelar" oncomplete="dlgEditarAnexo.hide();" icon="ui-icon-close"/>
                            </div>

                            <script>
                                $(document).ready(function() {
                                    $('#realtyForm\\:tabView\\:tipoAnexoEditar_panel').removeAttr('style');
                                    $('#realtyForm\\:tabView\\:tipoAnexoEditar_panel').css('width', 510);
                                });
                            </script>

                        </p:dialog>

                    </p:tab>

                    <p:tab id="tab7" title="Croqui">

                        <h4 class="title">Croqui</h4>

                        <p:panel id="docPanel" styleClass="container_24 clearfix">

                            <p:fileUpload 
                                mode="advanced"
                                label="Anexar"
                                uploadLabel="Enviar"
                                cancelLabel="Cancelar"
                                fileUploadListener="#{managerEditarImovel.handleAnnexCroqui}"
                                multiple="false"
                                auto="true"
                                allowTypes="/(\.|\/)(gif|jpe?g|png)$/"
                                dragDropSupport="true"
                                invalidFileMessage="Tipo de arquivo não suportado."
                                invalidSizeMessage="Tamanho do arquivo não é suportado"
                                immediate="true"
                                update=":realtyForm:tabView:docPanel" />
                            <div class="clear"/> 

                            <fieldset>
                                <legend>Anexos</legend>

                                <div class="my-simple-gallery" >
                                    <ui:repeat  value="#{managerEditarImovel.annexCroquis}" var="a">
                                        <h:panelGroup rendered="#{!managerImagem.pdf(a)}" >
                                            <div class="grid_4">
                                                <p:commandButton id="removeButton" alt="Remover" styleClass="ui-button-only button-remove"
                                                                 style="margin-right: -17px !important;"
                                                                 icon="ui-icon-trash" update=":realtyForm:tabView:docPanel" 
                                                                 onclick="dlgRemocaoCroqui.show()">
                                                    <f:setPropertyActionListener target="#{managerEditarImovel.removerCroqui}" value="#{a}" />
                                                </p:commandButton>
                                                <p:commandButton id="restaurarButton" alt="Restaurar" styleClass="ui-button-only button-restore"
                                                                 icon="ui-icon-newwin" 
                                                                 rendered="#{a.editado and a.id ne null}"
                                                                 onclick="dlgRestImagem.show()">
                                                    <f:setPropertyActionListener target="#{managerImagem.idAnexo}" value="#{a.id}"/>
                                                </p:commandButton>
                                                <figure itemprop="associatedMedia" style="width: 100%"
                                                        onclick="initPhoto(); habilitaEdicaoImagem(); processPanelGaleriaCroqui();">
                                                    <a href="#{managerImagem.urlImagem(a)}" 
                                                       itemprop="contentUrl" data-size="#{managerImagem.widthHeight(a)}" pid="#{a.id}">
                                                        <img src="#{managerImagem.urlThumbnailImagem(a)}" 
                                                             itemprop="thumbnail" class="image"/>
                                                    </a>
                                                    <figcaption itemprop="caption description">#{a.nomeExibicao}</figcaption>
                                                </figure>
                                            </div>
                                        </h:panelGroup>
                                    </ui:repeat>
                                    <ui:repeat  value="#{managerEditarImovel.annexCroquis}" var="a">
                                        <h:panelGroup rendered="#{managerImagem.pdf(a)}" >
                                            <div class="grid_4">
                                                <p:commandButton id="removeButton" alt="Remover" styleClass="ui-button-only button-remove"
                                                                 style="margin-right: -17px !important;"
                                                                 icon="ui-icon-trash" update=":realtyForm:tabView:docPanel" 
                                                                 onclick="dlgRemocaoCroqui.show()">
                                                    <f:setPropertyActionListener target="#{managerEditarImovel.removerCroqui}" value="#{a}" />
                                                </p:commandButton>
                                                <h:outputLink value="#{managerImagem.visualizarPdf(a)}" rendered="#{managerImagem.pdf(a)}"
                                                              title="#{a.nomeExibicao}" target="_blank">
                                                    <p:graphicImage styleClass="image grid_3 anexoImovel" url="#{managerImagem.urlPDF}"/>
                                                </h:outputLink>
                                            </div>
                                        </h:panelGroup>
                                    </ui:repeat>
                                </div>
                                <p:remoteCommand name="processPanelGaleriaCroqui" update=":realtyForm:tabView:docPanel" process=":realtyForm:tabView:docPanel" />
                            </fieldset>

                        </p:panel>

                        <p:dialog id="croquiModalDialog" width="440" widgetVar="dlgRemocaoCroqui" 
                                  modal="true" styleClass="container_24 clearfix"
                                  closable="false" resizable="false" closeOnEscape="true">

                            <p:outputLabel value="Deseja remover este anexo?" styleClass="grid_17" />

                            <div class="buttonAction">
                                <p:commandButton value="Sim" actionListener="#{managerEditarImovel.removerAnexoCroqui()}"
                                                 update=":realtyForm:tabView:docPanel, :realtyForm:tabView:croquiModalDialog" icon="ui-icon-check"/>
                                <p:commandButton value="Não" icon="ui-icon-close" oncomplete="dlgRemocaoCroqui.hide()" />
                            </div>
                        </p:dialog>

                    </p:tab>

                </p:tabView>
                <div class="clear"/>
                <div class="footer">
                    <h6>
                        <p:outputLabel value="Criado por: #{managerEditarImovel.imovel.groupCreate}
                                       em "  rendered="#{managerEditarImovel.imovel.groupCreate ne null}"/>
                        <h:outputLabel value="#{managerEditarImovel.imovel.createAt}"
                                       rendered="#{managerEditarImovel.imovel.groupCreate ne null}">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputLabel>
                    </h6>
                </div>
                <div class="clear"/>

                <p:blockUI id="BLOCK" block="realtyForm" trigger="btnAtualizar" > 
                    <p:graphicImage value="media/images/ajax-loader.gif"/>
                </p:blockUI> 

                <div class="buttonAction">
                    <p:commandButton value="Atualizar" icon="ui-icon-disk"
                                     id="btnAtualizar"
                                     update=":enderecoChangeForm:endNovoPanel, :enderecoChangeForm:proprietariosPanel, @form"
                                     widgetVar="btnAtualizar" process="@form"
                                     actionListener="#{managerEditarImovel.atualizar()}"
                                     styleClass="ui-priority-primary" />
                    <p:button href="visualizarimovel.xhtml?vImovel=#{managerEditarImovel.imovel.id}" value="Voltar"  icon="ui-icon-arrowreturnthick-1-w" />
                </div >

            </h:form>

            <h:form id="dlgVisuForm">
                <p:panel id="paneldlg" styleClass="container_24 clearfix ">
                    <p:dialog id="iddlg" header="Visualizar Dados" widgetVar="dlgVisu" modal="true" 
                              closeOnEscape="true" width="600" resizable="false" height="210">

                        <p:outputLabel value="Ponto" styleClass="grid_3" for="pontoText" />
                        <p:inputText id="pontoText" styleClass="grid_20" readonly="true"
                                     value="#{managerEditarImovel.visualizarCoordenada.ponto}" />
                        <div class="clear"/>

                        <p:outputLabel value="N" styleClass="grid_3" for="norteText" />
                        <p:inputText id="norteText" styleClass="grid_8" readonly="true"
                                     value="#{managerEditarImovel.visualizarCoordenada.convN}" />

                        <p:outputLabel value="E" styleClass="grid_4" for="lesteText" />
                        <p:inputText id="lesteText" styleClass="grid_7" style="width: 30%"
                                     readonly="true" value="#{managerEditarImovel.visualizarCoordenada.convE}" />
                        <div class="clear"/>

                        <p:outputLabel value="Azimute" styleClass="grid_3" for="azimuteText" />
                        <p:inputText id="azimuteText" styleClass="grid_8" readonly="true"
                                     value="#{managerEditarImovel.visualizarCoordenada.azimute}" />

                        <p:outputLabel value="Distância" styleClass="grid_4" for="disText" />
                        <p:inputText id="disText" styleClass="grid_7" style="width: 30%"
                                     readonly="true" value="#{managerEditarImovel.visualizarCoordenada.distancia}" />

                        <p:outputLabel value="Limite" styleClass="grid_3" for="limText" />
                        <p:inputTextarea id="limText" styleClass="grid_20" readonly="true"
                                         value="#{managerEditarImovel.visualizarCoordenada.limite}" />
                        <br/>

                        <div class="buttonAction">
                            <p:commandButton value="Fechar" process="@this" 
                                             onclick="dlgVisu.hide()" icon="ui-icon-circle-close" />
                        </div>

                    </p:dialog>
                </p:panel>

            </h:form>

            <h:form id="dlgDelForm">
                <p:panel id="paneldlg" styleClass="container_24 clearfix">
                    <p:dialog id="modalDialog" header="Confirmação de remoção" widgetVar="dlgCoordenada" modal="true" 
                              height="80" closable="false" resizable="false" closeOnEscape="true">
                        <h:outputText value="Tem certeza que deseja remover esta coordenada ?" />
                        <div class="buttonAction">
                            <p:commandButton value="Sim" actionListener="#{managerEditarImovel.removerCoordenadaDimensao}"
                                             update=":realtyForm:tabView:georefPanel, :realtyForm:tabView:georefCoordenadasPanel, :realtyForm:tabView:coordenadaAvancadoDados" 
                                             oncomplete="dlgCoordenada.hide()" icon="ui-icon-check"/>
                            <p:commandButton value="Não" icon="ui-icon-close"
                                             oncomplete="dlgCoordenada.hide()" />
                        </div>
                    </p:dialog>

                </p:panel>
            </h:form> 

            <!-- Dialog cadastro proprietario -->
            <h:form id="proprietarioForm" enctype="multipart/form-data">
                <p:dialog id="dlgProp" widgetVar="dlgProp" height="500" width="1024" appendToBody="false"
                          modal="true" styleClass="container_24 clearfix"
                          closeOnEscape="true" closable="true">

                    <br/>
                    <h3 class="title" style="#{managerProprietario.proprietario.id ne null ? 'display: none' : ''}" >Cadastrar Contribuinte</h3>
                    <h3 class="title" style="#{managerProprietario.proprietario.id ne null ? '' : 'display: none'}" >Contribuinte</h3>
                    <ui:include src="proprietarioform.xhtml"/>

                    <div class="buttonAction" style="#{managerProprietario.proprietario.id ne null ? 'display: none' : ''}">
                        <p:commandButton value="Salvar" icon="ui-icon-disk"
                                         actionListener="#{managerProprietario.save()}" oncomplete="addProp();"
                                         styleClass="ui-priority-primary" />
                        <p:remoteCommand name="addProp" update=":realtyForm:tabView:tableProprietario" actionListener="#{managerEditarImovel.addProprietario(managerProprietario.proprietarioSalvo)}" />

                        <p:commandButton value="Cancelar" icon="ui-icon-trash" 
                                         process="@this" oncomplete="dlgProp.hide()"/>
                    </div>

                    <div class="buttonAction" style="#{managerProprietario.proprietario.id ne null ? '' : 'display: none'}">
                        <p:commandButton value="Fechar" icon="ui-icon-close" oncomplete="dlgProp.hide()"/>
                    </div>
                    <script>
                        $(document).ready(function() {
                            $('#proprietarioForm\\:estadoCivilOutputlabel').removeClass('estadoCivilLabel');
                            $('#proprietarioForm\\:localTrabalhoOutputlabel').removeClass('localTrabalhoLabel');
                            $('#proprietarioForm\\:conjuge').removeClass('autocompleteConjuge');
                            $('#proprietarioForm\\:conjuge').addClass('autocompleteConjugeDlg');
                            $('#proprietarioForm\\:localTrabalhoOutputlabel').removeClass('localTrabalhoLabel');
                            $('#proprietarioForm\\:localTrabalhoOutputlabel').addClass('localTrabalhoLabelDlg');
                            $('#proprietarioForm\\:localTrabalhoInputText').removeClass('localTrabalhoInputTextContribuinte');
                            $('#proprietarioForm\\:localTrabalhoInputText').addClass('localTrabalhoInputTextContribuinteDlg');
                        });
                    </script>
                </p:dialog>

            </h:form>
            <p:dialog id="modalDialog" widgetVar="dlgProprietario" height="510"
                      modal="true" styleClass="container_24 clearfix"
                      closeOnEscape="true" closable="false" resizable="false">

                <ui:include src="conjugedialogform.xhtml"/>

            </p:dialog>

            <h:form id="enderecoChangeForm" enctype="multipart/form-data">
                <p:dialog id="enderecoChangeDlg" widgetVar="enderecoChangeDlg" height="300" width="1000"
                          modal="true" 
                          closeOnEscape="true" closable="false" resizable="false">

                    <h4 style="font-weight: bold;">Substituir o endereço dos proprietários pelo endereço deste imóvel?</h4>

                    <div style="width: 350px; float: left;">
                        <p:panel id="endNovoPanel" header="Endereço do Imóvel" styleClass="container_24 clearfix">
                            <p:outputLabel value="CEP" styleClass="grid_6" for="cepInputMask" />
                            <p:inputMask id="cepInputMask" styleClass="grid_17" mask="99.999-999"
                                         value="#{managerEditarImovel.endPropNovo.cep}" readonly="true" />
                            <p:outputLabel value="Lograd." styleClass="grid_6" 
                                           for="patioInputText" />
                            <p:inputText id="patioInputText" styleClass="grid_17" readonly="true"
                                         value="#{managerEditarImovel.endPropNovo.nomeclog eq null ? 
                                                  managerEditarImovel.endPropNovo.logradouro : managerEditarImovel.endPropNovo.nomeclog}" />
                            <p:outputLabel value="Bairro" styleClass="grid_6" for="neighborhoodInputText" />
                            <p:inputText id="neighborhoodInputText" styleClass="grid_17" readonly="true"
                                         value="#{managerEditarImovel.endPropNovo.bairroDne.nome}" />

                            <p:outputLabel value="Número" styleClass="grid_6" for="numInputText" />
                            <p:inputText id="numInputText" styleClass="grid_17" readonly="true"
                                         value="#{managerEditarImovel.endPropNovo.numero}" />

                            <p:outputLabel value="Compl." styleClass="grid_6" for="compInputText" />
                            <p:inputText id="compInputText" styleClass="grid_17" readonly="true"
                                         value="#{managerEditarImovel.endPropNovo.compl}" />
                        </p:panel>
                    </div>
                    <div style="width: 450px; float: left;">
                        <p:panel id="proprietariosPanel" header="Proprietários" styleClass="container_24 clearfix">
                            <div style="overflow-y: auto !important; height: 156px !important;">
                                <p:selectManyCheckbox id="grid" value="#{managerEditarImovel.proprietariosSelected}" layout="pageDirection"
                                                      style="border: none !important;" converter="proprietarioconverter">
                                    <f:selectItems value="#{managerEditarImovel.proprietariosSelected}"
                                                   var="proprietario" itemLabel="#{proprietario.nome}" itemValue="#{proprietario}" />
                                </p:selectManyCheckbox>
                            </div>
                        </p:panel>
                    </div>

                    <div class="clear"/>

                    <div class="buttonAction">
                        <p:commandButton value="Sim"
                                         actionListener="#{managerEditarImovel.alterarEnderecoProprietario()}"
                                         oncomplete="enderecoChangeDlg.hide()"
                                         update=":realtyForm"
                                         icon="ui-icon-check"/>
                        <p:commandButton value="Não"
                                         oncomplete="enderecoChangeDlg.hide();"
                                         actionListener="#{managerEditarImovel.cancelarEnderecoPropDlg()}"
                                         update=":realtyForm"
                                         icon="ui-icon-close"/>
                    </div>
                </p:dialog>
            </h:form> 

            <link rel='stylesheet prefetch' href='media/css/imovel.css'/>

            <script language="JavaScript" type="text/javascript">
                function required(rqd){
                    if(rqd){
                        $('#realtyForm\\:tabView\\:coordenadaAvancado_content .ui-outputlabel').each(function() {

                            var id = $(this).attr('for').replace(':', '\\:');
                            /* <![CDATA[ */
                            if ($(this).children('span').hasClass('required') && ($('#' + id).val() == '')) {
                                $(this).addClass('ui-state-error');
                                $('#' + id).addClass('ui-state-error');
                            }
                            /* ]]> */
                        });
                    }else{
                        $('#realtyForm\\:tabView\\:coordenadaAvancado_content').children().removeClass('ui-state-error');
                    }
                }
            </script>
        </ui:define>

    </ui:composition>

</html>
